"""
RedFire 数据模型
===============

提供独立的数据模型定义，避免循环依赖。
"""

from typing import Optional
from dataclasses import dataclass
from datetime import datetime


@dataclass
class MarketDataTick:
    """市场Tick数据"""
    symbol: str
    price: float
    volume: int = 0
    timestamp: datetime = None
    bid_price: Optional[float] = None
    ask_price: Optional[float] = None
    bid_volume: int = 0
    ask_volume: int = 0
    
    def __post_init__(self):
        if self.timestamp is None:
            self.timestamp = datetime.now()


@dataclass
class MarketDataBar:
    """市场K线数据"""
    symbol: str
    open: float
    high: float
    low: float
    close: float
    volume: int = 0
    timestamp: datetime = None
    
    def __post_init__(self):
        if self.timestamp is None:
            self.timestamp = datetime.now()


@dataclass
class ContractInfo:
    """合约信息"""
    symbol: str
    name: str = ""
    exchange: str = ""
    product_type: str = ""
    size: int = 1
    price_tick: float = 0.01
